import { defineComponent , reactive} from "vue";
import { useRouter } from "vue-router";
import * as db_context from '@/models/db_context'



export default defineComponent(() => {
  const router = useRouter()

  const state = reactive({
    loading: false, // 控制加载动画
    tableData: [] as any[], // 数据列表
    currentPage: 1, // 当前页数
    pageSize: 10, // 每页请求数

  });

  
  
  const loadData = () => {
    db_context.Template
  .getList<db_context.Template>()
  .then(results => {
      console.log('resultsxxxxx:',results);
      state.tableData=results;
  });

  }


  const handleClick = () => {
    state.pageSize=state.pageSize++
  }

  return () => {

    return (
      <div>


      <div class="header">
        <el-button type="primary" size="small" icon="el-icon-plus" >增加</el-button>
        <el-popconfirm
          title="确定删除吗？"
         
        >
       
            <el-button type="danger" size="small" icon="el-icon-delete">批量删除</el-button>
     
        </el-popconfirm>
      </div>


      <el-card class="swiper-container">
      <el-table  
       load={state.loading}
       data={state.tableData}
        tooltip-effect="dark"
        style="width: 100%"
       >
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          label="标题"
          prop="name"
         >
   
        </el-table-column>
        <el-table-column
          prop="code"
          label="开发语言"
          
        >
        </el-table-column>
      </el-table>
    </el-card>
    </div>
    );
  }
})